package protocol

import "errors"

var (
	ErrQuit           = errors.New("quit")
	ErrMpcResultExist = errors.New("mpc Result is not exist")
	ErrContextType    = errors.New("err Context Type is error")
	ErrTimeOut        = errors.New("mpc Request is TimeOut")
	ErrPointZero      = errors.New("mpc Point is zero")

	ErrFailedAddApproving = errors.New("mpc add approving data failed")
	ErrMpcContextExist    = errors.New("mpc Context ID is already exist")

	ErrInvalidMPCR           = errors.New("invalid signed data(R)")
	ErrInvalidMPCS           = errors.New("invalid signed data(S)")
	ErrVerifyFailed          = errors.New("verify failed")
	ErrGetDb                 = errors.New("get database failed")
	ErrWaitApproved          = errors.New("wait for being approved failed")
	ErrGetApproved           = errors.New("get being approved failed")
	ErrMarshal               = errors.New("marshal data failed")
	ErrApprovedNotConsistent = errors.New("not equal,received  data and approved data in DB")
	ErrTooLessDataCollected  = errors.New("not enough data collected")
	ErrTooLessDataApproved   = errors.New("not enough data approved")
	ErrAddApprovingBtcTran   = errors.New("fail to add approvingBtcTran")
	ErrSaveValue             = errors.New("mpc result setValue error")

	ErrRNW       = errors.New("R stage: no work")
	ErrSNW       = errors.New("S stage: no work")
	ErrSSlsh     = errors.New("S stage: malice")
	ErrRSlsh     = errors.New("R stage: malice")
	ErrInvalidPK = errors.New("invalid pk")
)

var (
	ErrTypeAssertFail = errors.New("type assert fail")
)

//////add for btc begin
var (
	ErrMpcSeedOutRange  = errors.New("mpc seeds are out range")
	ErrMpcSeedDuplicate = errors.New("mpc seeds have duplicate")
	ErrTooLessStoreman  = errors.New("mpc alive Storeman is not enough")
	ErrFailedDataVerify = errors.New("mpc signing data validate failed")
	ErrInvalidMPCAddr   = errors.New("invalid mpc account address")
)

var (
	ErrAddress        = errors.New("Mpc Address is not found")
	ErrChainID        = errors.New("Mpc ChainID is not Defined")
	ErrChainTypeError = errors.New("Mpc transaction chaintype error")

	ErrDecrypt = errors.New("could not decrypt key with given passphrase")

	ErrTooMoreStoreman = errors.New("Mpc alived Storeman is too more")
	ErrFailedTxVerify  = errors.New("Mpc signing transaction verify failed")

	ErrFailSignRetVerify    = errors.New("Mpc signing result verify failed")
	ErrInvalidStmAccType    = errors.New("invalid storeman account type! please input 'WAN' or 'ETH' or 'BTC' ")
	ErrInvalidMpcTx         = errors.New("invalid mpc transaction")
	ErrRecoverPkNotMatchPre = errors.New("pk recovered does not match preOne")
	ErrRecoverPkNotMatch    = errors.New("pk recovered does not match")
	ErrSignreqNotFromLeader = errors.New("sign request does not from leader")
)

var (
	ErrInvalidLen = errors.New("invalid length")
	ErrNotSupport = errors.New("not support")
	ErrNotOnCurve = errors.New("not on curve")
)

//////add for btc end

///// add for uniMpc begin
var (
	ErrMismatchLen = errors.New("len(hash) not equal len(rawData)")
)

///// add for uniMpc end
